Skip to content

Feature: createConnection should allow option to _not_ call conn.openUri, e.g. options.openUri: false #12970

@titanism

Description

@titanism

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Right now any invocation of createConnection(...) will cause the openUri() call in this conditional to get triggered:

mongoose/lib/index.js

Lines 350 to 352 in 8d9df24

if (arguments.length > 0) {
conn.openUri(uri, options, callback);
}

We suggest to add an option to createConnection of options.openUri: true and if false then this is not called.

-  if (arguments.length > 0) {
+  if (arguments.length > 0 && options.openUri) {
    conn.openUri(uri, options, callback);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new featurenew featureThis change adds new functionality, like a new method or class

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions